package o;

import android.text.TextUtils;
import com.huawei.appgallery.foundation.ui.css.CSSRule;
import com.huawei.appgallery.foundation.ui.css.CSSSelector;
import com.huawei.appgallery.foundation.ui.css.CSSStyleSheet;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.hms.framework.network.restclient.hwhttp.dns.DnsConfig;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.ListIterator;
import java.util.Set;

public class chz {
    private String ʻ;
    private int ʼ;
    private CSSRule ʽ;
    public int ˊ;
    private String ˊॱ;
    public cie ˋ;
    private String ˋॱ;
    public List<CardBean> ˎ = new ArrayList();
    public long ˏ;
    private boolean ͺ;
    public int ॱ = 0;
    private int ॱˊ;
    private boolean ॱॱ = false;
    protected Set<String> ᐝ = new HashSet();

    public chz(long j, cie o_cie, int i) {
        ˎ(j, o_cie, i, null);
    }

    public chz(long j, cie o_cie, int i, List<CardBean> list) {
        ˎ(j, o_cie, i, list);
    }

    public boolean ˊ() {
        return this.ͺ;
    }

    public void ˎ(boolean z) {
        this.ͺ = z;
    }

    protected void ˎ(long j, cie o_cie, int i, List<CardBean> list) {
        this.ˏ = j;
        this.ˋ = o_cie;
        this.ˊ = i;
        if (list != null) {
            this.ˎ.addAll(list);
        }
        this.ॱ = 0;
    }

    public boolean ˎ(String str) {
        if (str == null) {
            return false;
        }
        boolean contains = this.ᐝ.contains(str);
        if (contains) {
            return contains;
        }
        this.ᐝ.add(str);
        return contains;
    }

    public List<CardBean> ˏ() {
        return this.ˎ;
    }

    public CardBean ˎ() {
        if (ˏ(this.ˎ)) {
            return null;
        }
        return (CardBean) this.ˎ.get(ˋ() - 1);
    }

    public void ˎ(List<CardBean> list) {
        ˏ(ˋ(), list);
    }

    public void ˏ(int i, List<CardBean> list) {
        if (list != null) {
            this.ˎ.addAll(i, list);
            ॱ();
        }
    }

    public void ˊ(List<CardBean> list) {
        this.ˎ.clear();
        if (list != null && list.size() > 0) {
            this.ˊ = list.size();
            this.ˎ.addAll(list);
            ॱ();
        }
    }

    public CardBean ˋ(int i) {
        if (this.ॱ + i >= this.ˎ.size()) {
            return null;
        }
        try {
            return (CardBean) this.ˎ.get(this.ॱ + i);
        } catch (IndexOutOfBoundsException e) {
            return null;
        }
    }

    public CardBean ˊ(String str) {
        if (!(ˏ(this.ˎ) || TextUtils.isEmpty(str))) {
            ListIterator listIterator = this.ˎ.listIterator(this.ˎ.size());
            while (listIterator.hasPrevious()) {
                CardBean cardBean = (CardBean) listIterator.previous();
                if (str.equals(cardBean.ॱﹳ())) {
                    this.ˎ.remove(cardBean);
                    return cardBean;
                }
            }
        }
        return null;
    }

    public int ˋ() {
        return this.ˎ.size();
    }

    public int ᐝ() {
        return this.ʼ;
    }

    public void ˊ(int i) {
        this.ʼ = i;
    }

    public void ˋ(CSSStyleSheet cSSStyleSheet, String str) {
        if (cSSStyleSheet != null) {
            this.ʽ = new CSSSelector(str).getRule(cSSStyleSheet.getRootRule());
        }
    }

    public CSSRule ʻ() {
        return this.ʽ;
    }

    public String ʽ() {
        return this.ʻ;
    }

    public void ˏ(String str) {
        this.ʻ = str;
    }

    public boolean ʼ() {
        return this.ॱॱ;
    }

    public void ˏ(boolean z) {
        this.ॱॱ = z;
    }

    public String toString() {
        return new StringBuilder(DnsConfig.MAX_CACHE_ENTRIES).append("CardChunk {\n\tnode: ").append(this.ˋ).append("\n\tmaxLine: ").append(this.ˊ).append("\n\tcurrentItem: ").append(this.ॱ).append("\n\tid: ").append(this.ˏ).append("\n\tdataSource: ").append(ˋ()).append("\n}").toString();
    }

    private void ॱ() {
        if (!ˏ(this.ˎ)) {
            int ˋ = ˋ();
            for (int i = 0; i < ˋ; i++) {
                CardBean cardBean = (CardBean) this.ˎ.get(i);
                cardBean.ʽ(false);
                if (i == ˋ - 1) {
                    cardBean.ʽ(true);
                }
            }
        }
    }

    private <V> boolean ˏ(List<V> list) {
        return list == null || list.isEmpty();
    }

    public int ॱॱ() {
        return this.ॱˊ;
    }

    public void ˎ(int i) {
        this.ॱˊ = i;
    }

    public String ˏॱ() {
        return this.ˊॱ;
    }

    public void ॱ(String str) {
        this.ˊॱ = str;
    }

    public String ͺ() {
        return this.ˋॱ;
    }

    public void ˋ(String str) {
        this.ˋॱ = str;
    }
}
